//
//  ZZPassWordViewModel.m
//  新项目
//
//  Created by liGordon on 17/3/28.
//  Copyright © 2017年 刘耀宗. All rights reserved.
//

#import "ZZPassWordViewModel.h"

@implementation ZZPassWordViewModel
+(instancetype)shareViewModel{
    static id instance;
    static  dispatch_once_t once;
    dispatch_once(&once, ^{
        instance=[[self alloc] init];
    });
    return instance;
    
}
-(void)changePassWordWithLoginName:(NSString *)loginName andNewPassWord:(NSString *)newPassWord andOldPassWord:(NSString *)oldPassWord andSuccess:(void (^)(NSDictionary *))success andFailer:(void (^)())failer
{
    NSMutableDictionary *strDic = [NSMutableDictionary dictionary];
    [strDic setKey:@"LoginName" forValue:loginName];
    [strDic setKey:@"PassWord" forValue:newPassWord];
    [strDic setKey:@"OldPwssWord" forValue:oldPassWord];

    
    NSString *jsonStr=[WHJSON jsonStringWithObject:strDic];
    
    NSMutableDictionary *dic=[NSMutableDictionary dictionary];
    [dic setKey:@"data" forValue:jsonStr];
    
    
    [YBHttpTool post:@"api/CmpPerson/Login/UpdatePwd" params:dic success:^(NSDictionary *obj) {
        
        
        DLog(@"=====%@",obj);
        if ([obj isKindOfClass:[NSNull class]] || obj==nil) {
            DLog(@"返回值为空");
            return ;
        }
        success(obj);
        
    } failure:^(NSError *error) {
        DLog(@"%@",error);
        failer();
    }];

}


-(void)adviceFeedBackWithCompanyFID:(NSString *)companyFID andCompanyID:(NSString *)companyID andShopName:(NSString *)shopName andCompanyNmae:(NSString *)companyName andUserName:(NSString *)userName andUserCode:(NSString *)userCode andPhone:(NSString *)phone andContent:(NSString *)content andSuccess:(void (^)(NSDictionary *))success andFailer:(void (^)())failer
{
    NSMutableDictionary *strDic = [NSMutableDictionary dictionary];
    [strDic setKey:@"CompanyFID" forValue:companyFID];
    [strDic setKey:@"CompanyID" forValue:companyID];
    [strDic setKey:@"ShopName" forValue:shopName];
    [strDic setKey:@"CompanyName" forValue:companyName];
    [strDic setKey:@"UserName" forValue:userName];
    [strDic setKey:@"UserCode" forValue:userCode];
    [strDic setKey:@"Phone" forValue:phone];
    [strDic setKey:@"Content" forValue:content];
    NSString *jsonStr=[WHJSON jsonStringWithObject:strDic];
    
    NSMutableDictionary *dic=[NSMutableDictionary dictionary];
    [dic setKey:@"data" forValue:jsonStr];
    
    
    [YBHttpTool post:@"api/FeedBack/FeedBack/addFeedBack" params:dic success:^(NSDictionary *obj) {
        
        
        DLog(@"=====%@",obj);
        if ([obj isKindOfClass:[NSNull class]] || obj==nil) {
            DLog(@"返回值为空");
            return ;
        }
        success(obj);
        
    } failure:^(NSError *error) {
        DLog(@"%@",error);
        failer();
    }];
}
@end
